use serde::Serialize;
use crate::{lipo_error, lipo_info};
use crate::ltools::lreqwest::BaseParam;

pub(crate) mod lfile;
pub(crate) mod lring;
pub(crate) mod lntp;
pub(crate) mod ltime;
pub(crate) mod lstring;
pub(crate) mod lconstant;
pub(crate) mod lreqwest;
pub(crate) mod lmaths;

pub fn test() {
    // test_async();
  // println!("当前时间： {:?}",  ltime::get_print_format_time());
  //   test_read_license();

    // lstring::test_string_jx("我是你的小呀小苹果，123，hahha。");
    println!("开始读取");
    lfile::read_file_byte(r"D:\it\licenseaa.sign", |content|{
        // println!("一行信息： {}",content);
    }).unwrap_or_else(|e|{
        println!("没有找到文件");
        return;
    });
    println!("结束读取");
}

const URL:&str = "https://zyjs.zz24z.net/cache/excel/excel_sign_examinee_stj_1723356617811.xlsx";

fn test_read_license(){
    match lfile::read_file_byte(r"D:\it\license.sign", |content|{
        // println!("一行信息： {}",content);
    }) {
        Ok(_) => {},
        Err(_) => {},
    }
}

/* 异步运行时 */
fn test_async() {
    let runtime = tokio::runtime::Runtime::new();
    runtime.unwrap().block_on(async {
        // lntp::start_ntp("time.cloud.tencent.com").await;
        // lreqwest::send_post("https://zyjs.zz24z.net/signup/school/all", Some(EmptyParam{})).await;


        if let Err(e) = lreqwest::download_file(URL, r"D:\it\a.xlsx", |x| {
            lipo_info!(format!("进程为：{}",x));
        }).await {
            lipo_error!(format!("{:?}",e));
        }

    });
}

#[derive(Serialize)]
struct EmptyParam{}


